package com.sqx.modules.brand.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.brand.service.BrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description：TODO
 * @author： qiao
 * @create： 2024/10/14 19:34
 */
@RestController
@RequestMapping("/app/brand/")
@Api(value = "品牌相关-用户端", tags = {"品牌相关-用户端"})
public class AppBrandController {

    @Autowired
    private BrandService brandService;

    @GetMapping("selectByLabelId")
    @ApiOperation("根据分类id查询品牌")
    public Result selectByTypeId(@ApiParam(value = "标签分类id") Long labelId,
                                 @ApiParam(value = "是否热门品牌：1是热门品牌") Integer isHot,
                                 @ApiParam(value = "是否是回收类型 0否 1是") Integer isRecovery) {
        return brandService.selectByTypeIds(labelId, isHot, isRecovery);
    }

    @Login
    @GetMapping("selectByTypeIdByBrandName")
    @ApiOperation("根据分类名称查询品牌")
    public Result selectByTypeIdByBrandName(@ApiParam("用户id") @RequestAttribute Long userId,
                                            @ApiParam(value = "标签分类id") Long labelId,
                                            @ApiParam(value = "是否热门品牌：1是热门品牌") Integer isHot,
                                            @ApiParam(value = "是否是回收类型 0否 1是") Integer isRecovery,
                                            @ApiParam(value = "品牌名称") String brandName) {
        return brandService.selectByTypeIdByBrandName(labelId, isHot, isRecovery, brandName,userId);
    }

    @GetMapping("selectBrandByLabelId")
    @ApiOperation("根据主键id查询品牌")
    public Result selectBrandByLabelId(@ApiParam(value = "标签分类id") Long labelId) {
        return brandService.selectByTypeIds(labelId, null, null);
    }
}
